package org.slf4as.ext 
{
	import org.slf4as.IMarker;
	import org.slf4as.MarkerFactory;
	import org.slf4as.spi.LocationAwareLogger;
	/**
	 * Simple Logger used to log events. All events are directed to a logger named "EventLogger"
	 * with a level of INFO and with an Event marker.
	 * @author Ralph Goers
	 * @author Andreas Rønning
	 */
	public class EventLogger {

		private static const FQCN:String = "EventLogger";
		private static var EVENT_MARKER:IMarker = MarkerFactory.getMarker("EVENT");
		private static var eventLogger:LoggerWrapper = new LoggerWrapper(LoggerFactory.getLogger("EventLogger"), FQCN);
	
	  /**
	   * Logs the event.
	   *
	   * @param data The EventData.
	   */
	  public static function logEvent(data:EventData):void {
			if (eventLogger.instanceofLAL) {
				LocationAwareLogger(eventLogger.logger).log(EVENT_MARKER, FQCN, LocationAwareLogger.INFO_INT, data.toXML(), null, null);
			} else {
				eventLogger.logger.info(EVENT_MARKER, data.toXML(), data);
			}
		}
	}

}